//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class Bevel : IOfficeXmlSerializableAs
    {
        private int h;
        private BevelPresetType preset;
        private int w;

        public int W
        {
            get { return w; }
            set { w = value; }
        }

        public int H
        {
            get { return h; }
            set { h = value; }
        }

        public BevelPresetType Preset
        {
            get { return preset; }
            set { preset = value; }
        }

        #region IOfficeXmlSerializableAs Members

        void IOfficeXmlSerializableAs.ReadXmlAs(string name, ReadContext context)
        {
            using (var c = context.Read(name))
            {
                W = c.GetOptionalInteger("w", 76200);
                H = c.GetOptionalInteger("h", 76200);
                Preset = c.GetOptionalEnum("prst", BevelPresetType.Circle);
            }
        }

        void IOfficeXmlSerializableAs.WriteXmlAs(string name, WriteContext context)
        {
            using (WriteContext c = context.Write(name))
            {
                c.SetOptionalInteger("w", W, 76200);
                c.SetOptionalInteger("h", H, 76200);
                c.SetOptionalEnum("prst", Preset, BevelPresetType.Circle);
            }
        }

        #endregion
    }
}